/*
 * @Author: Yang Zhang
 * @Date: 2021-12-01 00:17:53
 * @LastEditors: Yang Zhang
 * @LastEditTime: 2021-12-07 23:11:07
 * @Description: 
 */


import { request } from "../utils/request"
import { IUserLogin, IUserreg } from "./types"

const api = {
  Login: '/store/login/userLogin',
  Register: '/store/login/register',
  Seting: '/store/settings',
  refreshToken: '/store/login/refresh/{refreshToken}'
}


/**
 * @description 登录
 */
export const userLogin = (data: IUserLogin) => {
  return request({
    url: api.Login,
    method: 'post',
    data,
    formData: true
  })
}


/**
 * @description：注册
 */
export const userRegi = (data: IUserreg) => {
  return request({
    url: api.Register,
    method: 'post',
    data,
    formData: true
  })
}

/**
 * @description:获取登录信息
 * 
 */
export const getSetting = () => {
  return request({
    url: api.Seting,
    method: 'get'
  })
}

/**
 * @description:刷新token
 */
export const RefreshToken = (token: string) => {
  return request({
    url: api.refreshToken,
    method: 'get',
    param: {
      refreshToken: token
    }
  })
}